/*
 * PACKAGE NAME: com.jodinfo.outmirror.implementation.officialusr.service
 * FILE    NAME: OfficialUsrDaoImpl.java
 * COPYRIGHT: Copyright(c) © 2016 heroj Company Ltd. All Rights Reserved
 */ 
package com.jodinfo.outmirror.service.impl;


import java.math.BigInteger;
import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import com.jodinfo.outmirror.dao.OfficialUsrDao;
import com.jodinfo.outmirror.entity.OfficialUsrEntity;
import com.jodinfo.outmirror.service.OfficialUsrQueryService;

@Service(value="officialUsrQueryService")
public class OfficialUsrQueryServiceImpl implements OfficialUsrQueryService {

  private static final Logger logger = LoggerFactory.getLogger(OfficialUsrQueryService.class);
 
	@Resource(name="officialUsrDao")
	private OfficialUsrDao officialUsrDao;
	
	/** 
	 * 
	 * @author zhuxiaoliu
	 * @date 2016年12月30日 上午9:15:36
	 * @see com.jodinfo.outmirror.implementation.officialusr.OfficialUsrQueryService#queryAllOfficialUsr(OfficialUsrEntity officialUsrEntity)
	 * @param OfficialUsrEntity officialUsrEntity
	 * @return List<OfficialUsrEntity>
	 */
	@Cacheable(sync=true,keyGenerator="redisKeyGenerator")
	public List<OfficialUsrEntity> queryAllOfficialUsr(OfficialUsrEntity officialUsrEntity) {
		
		return officialUsrDao.queryList(officialUsrEntity);
	}
	/** 
	 * 
	 * @author zhuxiaoliu
	 * @date 2016年12月30日 上午9:15:36
	 * @see com.jodinfo.outmirror.implementation.officialusr.OfficialUsrQueryService#queryAllOfficialUsr(OfficialUsrEntity officialUsrEntity)
	 * @param OfficialUsrEntity officialUsrEntity
	 * @return List<OfficialUsrEntity>
	 */
	@Cacheable(sync=true,keyGenerator="redisKeyGenerator")
	public List<OfficialUsrEntity> queryListForPageOfficialUsr(OfficialUsrEntity officialUsrEntity) {
		
		return officialUsrDao.queryListForPage(officialUsrEntity,officialUsrEntity.getPageIndex(),officialUsrEntity.getPageSize());
	}
	/** 
	 * 
	 * @author zhuxiaoliu
	 * @date 2016年12月30日 上午9:15:36
	 * @see com.jodinfo.outmirror.implementation.officialusr.OfficialUsrQueryService#queryCountOfficialUsr(OfficialUsrEntity officialUsrEntity)
	 * @param OfficialUsrEntity officialUsrEntity
	 * @return Long
	 */
	@Cacheable(sync=true,keyGenerator="redisKeyGenerator")
	public Long queryCountOfficialUsr(OfficialUsrEntity officialUsrEntity) {
		
		return officialUsrDao.queryCount(officialUsrEntity);
	}  
	
	/** 
	 * 
	 * @author zhuxiaoliu
	 * @date 2016年12月30日 上午9:15:36
	 * @see com.jodinfo.outmirror.implementation.officialusr.OfficialUsrQueryService#queryByID(OfficialUsrEntity officialUsrEntity)
	 * @param BigInteger id
	 * @return
	 */
	@Cacheable(sync=true,keyGenerator="redisKeyGenerator")
	public OfficialUsrEntity queryById(BigInteger id) {
		
		return officialUsrDao.queryById(id);
	}
	/** 
	 * 
	 * @author zhuxiaoliu
	 * @date 2016年12月30日 上午9:15:36
	 * @see com.jodinfo.outmirror.implementation.officialusr.OfficialUsrQueryService#queryByIds(List<BigInteger> ids)
	 * @param List<BigInteger> ids
	 * @return List<OfficialUsrEntity>
	 */
	@Cacheable(sync=true,keyGenerator="redisKeyGenerator")
	public List<OfficialUsrEntity> queryByIds(List<BigInteger> ids) {
		 
		 return officialUsrDao.queryByIds(ids);
	}
	/** 
	 * 
	 * @author zhuxiaoliu
	 * @date 2016年12月30日 上午9:15:36
	 * @see com.jodinfo.outmirror.implementation.officialusr.OfficialUsrQueryService#queryByEntity(OfficialUsrEntity officialUsrEntity)
	 * @param List<BigInteger> ids
	 * @return List<OfficialUsrEntity>
	 */
	@Cacheable(sync=true,keyGenerator="redisKeyGenerator")
	public OfficialUsrEntity queryByEntity(OfficialUsrEntity officialUsrEntity) {
		List<OfficialUsrEntity> officialList = officialUsrDao.queryList(officialUsrEntity);
		if (officialList == null || officialList.size() == 0) {
			return null;
		}else{
			return officialList.get(0);
		}
		
	}
}

